#ifndef WRAP_POLL_H
#define WRAP_POLL_H

struct pollfd;

namespace Wrap
{

using nfds_t_ = long unsigned;

short poll_in();
short poll_pri();
short poll_out();
short poll_err();
short poll_hup();
short poll_nval();
short poll_remove();
short poll_rdhup();

/// @see https://man7.org/linux/man-pages/man2/poll.2.html
/// @return On success, poll() returns a nonnegative value which is the number
/// of elements in the pollfds whose revents fields have been set to a nonzero
/// value (indicating an event or an error). A return value of zero indicates
/// that the system call timed out before any file descriptors became read. On
/// error, -1 is returned, and errno is set to indicate the error.
/// @throw EFAULT @c fds points outside the process's accessible address space.
/// The array given as argument was not contained in the calling program's
/// address space.
/// @throw EINTR A signal occurred before any requested event; see signal(7).
/// @throw EINVAL The @c nfds value exceeds the RLIMIT_NOFILE value.
/// @throw ENOMEM Unable to allocate memory for kernel data structures.
int poll_(struct pollfd *fds, nfds_t_ nfds, int timeout);


} // namespace Wrap


#endif